package utils

import (
	"crypto/tls"
	"net/smtp"

	"github.com/jordan-wright/email"
)

func SendSetPadEmail(targetEmail, code string) {
	e := email.NewEmail()
	e.From = "LHJ <coder_generate@163.com>"
	e.To = []string{targetEmail}
	e.Subject = "【LHJ】 密码找回"
	e.HTML = []byte(`
		<div style="padding: 20px;text-align:center;background: #fff;">
			<div><img src="http://api.wewin888.cn/uploads/9182f117-fd1e-5471-bf47-0e7dc6179822.jpg"/></div>
			<div style="margin: 10px 0;">您的验证码：<h3 style='display: inline-block'>` + code + `</h3> 五分中内有效！！！</div>
			<div><a target="_blank" href="admin.wewin888.cn/login">密码设置</a></div>
		</div>`)
	e.SendWithTLS("smtp.163.com:465",
		smtp.PlainAuth("", "coder_generate@163.com", "MBVCIQTAJJNYKFMY", "smtp.163.com"),
		&tls.Config{InsecureSkipVerify: true, ServerName: "smtp.163.com"})
}
